Skip to main content

delete URL

Type

command

Summary

Removes a file or directory from a server, or removes a file from your system.

Syntax

delete URL <URLtoDelete>

Description

Use the delete URL command to remove a file.

You can use a file or binfile URL to delete a file, but not a folder. To remove a folder from your system, use the delete folder command. (You can also use the delete file command to delete a local file.)

This command can also be used to remove files and directories your stack did not create. Of course, a stack should not remove data it didn't create without obtaining explicit confirmation from the user.

Normally, FTP servers do not allow anonymous users to delete files, for obvious reasons. This means that while an ftp URL without a user name and password is valid, you will almost always need a user name and password to use the delete URL command.

note

When used with an ftp or http URL, the delete URL command is blocking: that is, the handler pauses until LiveCode is finished deleting the URL. Since deleting a file from a server may take some time due to network lag, the delete URL command may take long enough to be noticeable to the user.

Important

The delete URL command is part of the Internet library on desktop platforms. To ensure that the command works in a desktop standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "Internet" script library is selected.

Cross-platform note

On iOS and Android, delete URL is implemented in the engine. Therefore the Internet library is not needed to ensure the command works in a mobile standalone application. If included, the Internet library implementation will be used instead of the engine implementation.

Cross-platform note

The Web engine only supports HTTP and HTTPs protocols.

Cross-platform note

URLs fetched by the Web engine from a domain other than that of the hosting the page may be blocked by web browsers, unless the server hosting the URL sets the "Access-Control-Origin" header appropriately.

Parameters

NameTypeDescription

URLtoDelete

The URLtoDelete specifies the name and location of the file or directory to delete, in the form of a URL.

Examples

delete URL "ftp://root:secret-word@mars.example.org/deleteable.txt"
delete URL "ftp://me:mine@ftp.example.net/trash/"
answer file "Select the file you wish to delete."
put it into tFileToDelete
delete URL ("file:" & tFileToDelete)

message: startup, openBackground, preOpenStack, openStack, preOpenCard

command: libURLSetFTPStopTime, post, delete file, delete folder

control structure: function

function: result

glossary: LiveCode custom library, application, standalone application, statement, blocking, Standalone Application Settings, command, expression, main stack, group, local file, server, upload, folder, message, handler

keyword: binfile, ftp, file, URL, http

library: put, library, Internet library

Compatibility and Support

Introduced

LiveCode 1.1

OS

mac

windows

linux

ios

android

web

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?